{% extends "base.html" %}

{% block content %}
<div class="container mt-4">
    <div class="row justify-content-center">
        <div class="col-md-8">
            <div class="card">
                <div class="card-header">
                    <h4 class="card-title mb-0">编辑仓库</h4>
                </div>
                <div class="card-body">
                    <form method="POST">
                        <div class="mb-3">
                            <label class="form-label">仓库名称</label>
                            <input type="text" class="form-control" name="name" value="{{ warehouse.name }}" required>
                        </div>
                        <div class="mb-3">
                            <label class="form-label">位置</label>
                            <input type="text" class="form-control" name="location" value="{{ warehouse.location }}" required>
                        </div>
                        <div class="mb-3">
                            <label class="form-label">容量(m³)</label>
                            <input type="number" class="form-control" name="capacity" value="{{ warehouse.capacity }}" step="0.01" required>
                        </div>
                        <div class="mb-3">
                            <label class="form-label">温度(°C)</label>
                            <input type="number" class="form-control" name="temperature" value="{{ warehouse.temperature }}" step="0.1" required>
                        </div>
                        <div class="mb-3">
                            <label class="form-label">湿度(%)</label>
                            <input type="number" class="form-control" name="humidity" value="{{ warehouse.humidity }}" step="0.1" required>
                        </div>
                        <div class="mb-3">
                            <label class="form-label">状态</label>
                            <select class="form-select" name="status">
                                <option value="normal" {% if warehouse.status == 'normal' %}selected{% endif %}>正常</option>
                                <option value="maintenance" {% if warehouse.status == 'maintenance' %}selected{% endif %}>维护中</option>
                                <option value="full" {% if warehouse.status == 'full' %}selected{% endif %}>已满</option>
                            </select>
                        </div>
                        <div class="mb-3">
                            <label class="form-label">备注</label>
                            <textarea class="form-control" name="notes" rows="3">{{ warehouse.notes }}</textarea>
                        </div>
                        <div class="d-grid gap-2">
                            <button type="submit" class="btn btn-primary">保存修改</button>
                            <a href="{{ url_for('storage.warehouse_list') }}" class="btn btn-secondary">返回</a>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>
{% endblock %} 